package Practice07;

import java.io.*;
import java.util.Arrays;

public class test5 {

    public static void main(String[] args) {

        File f = new File("E:\\IDEAworks\\hdu_-java\\Practice\\src\\Practice07\\test.txt");

        FileOutputStream fos = null;
        FileInputStream fis = null;
        try {
            fos = new FileOutputStream(f,true);
            fos.write("HelloWorld".getBytes());
            byte[] b = new byte[512];
            fis = new FileInputStream(f);
            fis.read(b);
            System.out.println(new String(b).trim());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                if (fis != null) {
                    fis.close();
                }
                if (fos != null) {
                    fos.close();
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
